package com.softer.wxzj.service;

import com.softer.wxzj.common.entity.CommonResult;
import com.softer.wxzj.common.util.StringUtils;
import com.softer.wxzj.entity.DepModeInfo;
import com.softer.wxzj.service.base.BaseService;

import java.util.List;

/**
 * @Author ludexing
 * @Date 2019-6-25 20:28
 */
public interface DepModeInfoService extends BaseService<DepModeInfo> {

    CommonResult save(DepModeInfo depModeInfo);

    CommonResult enable(DepModeInfo depModeInfo);

    /**
     * 查询
     * @param depModeInfo
     * @return
     */
    List<DepModeInfo> selectByAllChange(DepModeInfo depModeInfo);

    List<DepModeInfo> getListByHouseId(String houseId);

    /**
     * 1.8 新特性  接口的默认方法
     *
     * @param depModeInfo
     * @return
     */
    default CommonResult checkDepModeInfo(DepModeInfo depModeInfo) {
        //TODO 限制 带需求明确   加
        if (depModeInfo == null) {
            return CommonResult.ResponseResult(0);
        }
        if (StringUtils.isEmpty(depModeInfo.getName())) {
            return CommonResult.ResponseResult(0, "名称不能为空");
        }
        if (StringUtils.isEmpty(depModeInfo.getDepType())) {
            return CommonResult.ResponseResult(0, "缴存标准不能为空");
        }
        if (depModeInfo.getRatio() == null) {
            return CommonResult.ResponseResult(0, "缴存比例不能为空");
        }
        if (StringUtils.isEmpty(depModeInfo.getStartTime())) {
            return CommonResult.ResponseResult(0, "启用日期不能为空");
        }
        return null;
    }


    List<DepModeInfo> getListNoPage(String modeType);
}
